package com.zyb.beiojbackendjudgeservice.strategy;

import com.zyb.beiojmodel.model.codesandbox.QuestionJudgeInfo;
import org.springframework.stereotype.Service;

/**
 * @author 十八岁讨厌编程
 * @date 2025/2/11 12:57
 * @PROJECT_NAME beioj-backend
 * @description 用于策略的选择
 */

@Service
public class StrategyManager {

    public QuestionJudgeInfo doJudge(StrategyContext strategyContext){
        String language = strategyContext.getQuestionSubmit().getLanguage();
        switch (language) {
            case "java":
                JudgeStrategy javaJudgeStrategy = new JavaJudgeStrategy();
                return javaJudgeStrategy.doJudge(strategyContext);
            default:
                JudgeStrategy defaultJudgeStrategy = new DefaultJudgeStrategy();
                return defaultJudgeStrategy.doJudge(strategyContext);
        }

    }
}
